import { defineStore } from "pinia";
import { reactive } from "vue";
import type { chapterForm } from "@/api/type";

export const useChapterStore = defineStore(
  "chapter",
  () => {
    // 用户信息
    var chapterList = reactive<chapterForm[]>([]);
    //提供方法
    const setChapterList = (chapter: chapterForm[]) => {
      chapterList = chapter;
    };
    const removeChapterList = () => {
      chapterList = [];
    };

    return { chapterList, setChapterList, removeChapterList };
  },
  {
    persist: true,
  }
);
